{extend name="public:layout" /}
{block name="title"}商品管理{/block}
{block name="head"}{/block}
{block name="body"}
<div class="wrapper wrapper-content">
    <div class="ibox">
        <div class="ibox-title">
            <ol class="breadcrumb">
                <li><i class="fa fa-hand-o-right"></i> 商品列表</li>
            </ol>
        </div>
        <div class="ibox-content">
            <div class="toolbar">
                <form class="form-inline" method="post" id="searchForm">
                    <input name="site_cid" type="hidden" />
                    <div class="form-group">
                        <input class="form-control" name="goods_name" value="{$query.goods_name}" type="text" placeholder="商品关键词">
                    </div>
                    <button type="submit" class="btn btn-info">
                        <i class="fa fa-search"></i> 搜索
                    </button>
                    <a class="btn btn-white" href="{:url('index')}">
                        <i class="fa fa-trash"></i> 清空
                    </a>
                    <div class="form-group">
                        <select class="form-control" id="locatlSiteCid">
                            <option value="">快速跳转</option>
                            {volist name="siteGroup" id="vo"}
                            <option value="{$vo.cid}" {eq name="query.site_cid" value="$vo['cid']"}selected{/eq}>{$vo._name}</option>
                            {/volist}
                        </select>
                    </div>
                </form>
            </div>
            <form method="post" class="form-horizontal" id="form" style="padding-top:0;">
            <table class="table table-bordered">
                <thead>
                <tr>
                    <th width="50">#</th>
                    <th width="60">缩略图</th>
                    <th width="120">货号</th>
                    <th>商品名称</th>
                    <th width="60">sku</th>
                    <th width="80">单位</th>
                    <th width="120">市场价</th>
                    <th width="120">销售价</th>
                    <th width="80">库存</th>
                    <th width="80">库存报警</th>
                    <th width="80">运费</th>
                    <th width="80">起订量</th>
                    <th width="80">包装量</th>
                </tr>
                </thead>
                <tbody>
                {volist name="list" id="vo"}
                <tr>
                    <td>{$vo.goods_id}</td>
                    <td><img src="{$vo.goods_thumb|default='/public/nopic.gif'}" class="pull-left" style="width:32px;height:32px;margin:4px;" /></td>
                    <td><input type="text" class="form-control" name="sku_list[{$vo.sku_id}][sku_sn]" value="{$vo['sku_sn']}"/></td>
                    <td><input type="text" class="form-control" name="goods_list[{$vo.goods_id}][goods_name]" value="{$vo['goods_name']}"/></td>
                    <td>
                        {empty name="vo.sku_name"}
                        无
                        {else/}
                        <button type="button" class="btn btn-default" data-toggle="tooltip" data-placement="right" title="{$vo.sku_name}">查看</button>
                        {/empty}
                    </td>
                    <td><input type="text" class="form-control" name="goods_list[{$vo.goods_id}][goods_unit]" value="{$vo['goods_unit']}"/></td>
                    <td><input type="text" class="form-control" name="sku_list[{$vo.sku_id}][market_price]" value="{$vo['market_price']}"/></td>
                    <td><input type="text" class="form-control" name="sku_list[{$vo.sku_id}][goods_price]" value="{$vo['goods_price']}"/></td>
                    <td><input type="text" class="form-control" name="sku_list[{$vo.sku_id}][goods_stock]" value="{$vo['goods_stock']}"/></td>
                    <td><input type="text" class="form-control" name="goods_list[{$vo.goods_id}][alert_num]" value="{$vo['alert_num']}"/></td>
                    <td><input type="text" class="form-control" name="sku_list[{$vo.sku_id}][goods_freight]" value="{$vo['goods_freight']}"/></td>
                    <td><input type="text" class="form-control" name="sku_list[{$vo.sku_id}][minimum]" value="{$vo['minimum']}"/></td>
                    <td><input type="text" class="form-control" name="sku_list[{$vo.sku_id}][step]" value="{$vo['step']}"/></td>
                </tr>
                {/volist}
                </tbody>
            </table>
            <div class="pull-left">
                <button class="btn btn-primary" type="button" style="margin-top:8px;" id="btnSub">批量设置</button>
            </div>
            <div class="page-bar">{$list->render()}</div>
            <div class="clearfix"></div>
            </form>
        </div>
    </div>
</div>
{/block}
{block name="script"}
<script type="text/javascript">
    $(function () {
        ajaxSubForm('#btnSub');
        $('#locatlSiteCid').change(function () {
            var siteCid=$(this).val();
            $("input[name='site_cid']").val(siteCid);
            $('#searchForm').submit();
        });
    });
</script>
{/block}